package com.example.SBootDemo.model.function;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="role")
public class role {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;
	//角色名称
	private String rolename;
	//角色备注
	private String note;
	
	private int ifadmin=0;
	
	 @ManyToMany(fetch = FetchType.EAGER)                                       //多对多关系  
	       
	 @JoinTable(name="role_function",                     //中间表的名称
	             joinColumns={@JoinColumn(name="role_id")},   //本表与中间表的外键对应关系
	             inverseJoinColumns={@JoinColumn(name="function_id")}) //另一张表与中间表的外键的对应关系
	 List<function> funlist = new ArrayList<>();
	
	
	
	
	public List<function> getFunlist() {
		return funlist;
	}
	public void setFunlist(List<function> funlist) {
		this.funlist = funlist;
	}
	public int getIfadmin() {
		return ifadmin;
	}
	public void setIfadmin(int ifadmin) {
		this.ifadmin = ifadmin;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getRolename() {
		return rolename;
	}
	public void setRolename(String rolename) {
		this.rolename = rolename;
	}
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	
	
	public role(int id, String rolename, String note) {
		super();
		this.id = id;
		this.rolename = rolename;
		this.note = note;
	}
	public role() {
	
	}
	
	
	
}
